#ifndef K_UDP_SOCKET_H
#define K_UDP_SOCKET_H
#pragma once

#include "KSockAddress.h"
#include "KSocket.h"

class KUdpSocket : public KSocket {
public:
    virtual int protocol() const            { return IPPROTO_UDP; }
    virtual int sockType() const            { return SOCK_DGRAM; }
public:
    const KIpAddress &fromAddress() const   { return m_addrFrom; }
    virtual bool getRemoteAddress(KIpAddress &addrRemote) const;
protected:
    virtual bool asyncRecv(LPWSABUF pBuf, LPOVERLAPPED request);
    virtual bool asyncSend(LPWSABUF pBuf, LPOVERLAPPED request);
private:
    KIpAddress m_addrFrom;
};

#endif // K_UDP_SOCKET_H